import java.util.Scanner;

/**
 * Class for handling IO
 * 
 * @author Color Lee
 * 
 */
public class IO {
	
	final static Scanner in = new Scanner(System.in);
	
	/**
	 * Show the question to user and return the response
	 * @param q - Content of question 
	 * @return The user input as string if available
	 */
	public String showQuestionString(String q){
		printQuestion(q);
		return in.next();
	}
	
	/**
	 * Show the question to user and return the response
	 * @param q - Content of question
	 * @return The user input as integer if available
	 */
	public int showQuestionInt(String q){
		printQuestion(q);	
		return in.nextInt();
	}
	
	private void printQuestion(String q){
		System.out.print(q);
	}
	
	/**
	 * Show the commands menu to user
	 */
	public void showCommandsMenu(){
		System.out.print("\nMenu:\n");
		System.out.print( "1.  Evaluate the expression\n");
		System.out.print( "2.  Listing of evaluation steps\n");
		System.out.print( "3.  Build the expression tree\n");
		System.out.print( "4.  Fully parenthesize the expression based on the expression tree\n");
		System.out.print( "d.  Display the expression and variable(s)\n");
		System.out.print( "v.  Re-enter variable value(s)\n");
		System.out.print( "x.  Quit the program\n\n");
	}
}
